<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.2.1/axios.js"></script>
</head>

<body>
    <ul class="list">
        <li></li>
    </ul>
    <button>获取电影</button>
    <button>添加电影</button>
    <button>修改电影</button>
    <button>局部修改</button>
    <button>删除电影</button>
    <script>
        // 获取ul和按钮
        let ul = document.querySelector('ul');
        let btns = document.querySelectorAll('button');

        //获取电影列表
          btns[0].onclick =async function(){
            // axios.get('http://localhost:3000/movies').then(val=>{
            //     console.log(val);
            // })
           let {data} =await axios.get('http://localhost:3000/movies');
           console.log(data);
        }

        // 添加电影
        btns[1].onclick = async function(){
            // 参数1：url
            // 参数2：data
            let {data} = await axios.post('http://localhost:3000/movies',{
                name:"西红柿首富",
                director:"沈腾",
                star:"沈腾"
            })

            console.log(data);
        }
        
    
        // 修改电影
        

        // 局部修改
        
    
        // 删除电影
        
    </script>
</body>

</html>